home *** CD-ROM | disk | FTP | other *** search
- /*
- ** Apple Macintosh Developer Technical Support
- **
- ** File: Start.c
- ** Written by: Eric Soldan
- **
- ** Copyright © 1989-1993 Apple Computer, Inc.
- ** All rights reserved.
- */
-
- /* You may incorporate this sample code into your applications without
- ** restriction, though the sample code has been provided "AS IS" and the
- ** responsibility for its operation is 100% yours. However, what you are
- ** not permitted to do is to redistribute the source as "DSC Sample Code"
- ** after having made changes. If you're going to re-distribute the source,
- ** we require that you make it clear in the source that the code was
- ** descended from Apple Sample Code, but that you've made changes. */
-
-
-
- /*****************************************************************************/
-
-
-
- #include "App.h" /* Get the application includes/typedefs, etc. */
- #include "App.defs.h" /* Get various application definitions. */
- #include "App.protos.h" /* Get the prototypes for application. */
-
- #ifndef __TEXTSERVICES__
- #include <TextServices.h>
- #endif
-
- #ifndef __TOOLUTILS__
- #include <ToolUtils.h>
- #endif
-
- #ifndef __ATGLIB__
- #include "ATGLIB.h"
- #endif
-
-
-
- /*****************************************************************************/
-
- /* In this file, we first set some global values. This allows the application and
- ** DTS.Lib..framework to "know" what is expected for certain actions.
- **
- ** Note that the management of globals has changed in AppsToGo version 8.0
- ** This is so shared library support could be added to AppsToGo. The globals
- ** that used to be defined in the application have been moved into the library.
- ** This is because application can see library globals, but not visa-versa.
- ** Of course, this means that the globals are set to some reasonable initial
- ** value in the framework, and now need to be modified via code in the application.
- ** The code in DoOpenApplication does this.
- **
- ** DoOpenApplication used to be in the file Window.c. Now that this new functionality
- ** has been added, it makes more sense that this function be moved into Start.c. */
-
- extern void _DataInit();
-
- /**/
-
- extern TreeObjProcPtr gTreeObjMethods[], *gpTreeObjMethods;
- extern long gMinTreeObjSize[], *gpMinTreeObjSize;
-
- extern short gMinVersion, gMaxVersion;
- extern short gQuickBalloons;
-
-
-
- /*****************************************************************************/
-
-
-
- /* •• You don't call this. DTS.Lib..framework does at open-application time. •• */
-
-
- OSErr DoOpenApplication(void)
- {
- gMinVersion = kMinVersion; /* Minimum document version app can support. */
- gMaxVersion = kMaxVersion; /* Maximum document version app can support. */
-
- gpTreeObjMethods = gTreeObjMethods; /* Let framework know about File.c object defs. */
- gpMinTreeObjSize = gMinTreeObjSize;
-
- gQuickBalloons = (shiftKey | controlKey);
-
- return(noErr);
- }
-
-
-
- /*****************************************************************************/
- /*****************************************************************************/
-
- #ifdef applec
- #pragma segment Main
- #endif
-
- /*****************************************************************************/
- /*****************************************************************************/
-
-
-
- void main(void)
- {
-
- #ifdef applec
- UnloadSeg((Ptr)_DataInit); /* Note that _DataInit can't be in Main! */
- #endif
-
- SetApplLimit(GetApplLimit() - 16384);
- /* This decreases the application heap by 16k, which in turn
- ** increases the stack by 16k. */
-
- MaxApplZone(); /* Expand the heap so code segments load at the top. */
-
- InitATGLIB();
-
- Initialize(32, kMinHeap, kMinSpace, nil, nil); /* Initialize the program. */
- DoSetResCursor(watchCursor); /* Rest of startup may take a while. */
- InitRequiredAppleEvents();
- InitWFMTAppleEvents();
- CLVInitialize();
-
- DoOpenApplication();
- GetWindowFormats(); /* Get the window definition resource information. */
-
- // ReadPreferences('aprf', gSignature, kPrefFileName);
- // DefaultPreferences();
- OpenRuntimeOnlyAutoNewWindows();
- DoAdjustMenus();
- StartDocuments(); /* Open (or print) designated documents for 6.0. */
-
- if(CTEUseTSMTE())
- InitTSMAwareApplication();
-
- UnloadSeg((Ptr)Initialize); /* Initialize can't be in Main! */
- EventLoop(); /* Call the main event loop. */
-
- if(CTEUseTSMTE())
- CloseTSMAwareApplication();
-
- // WritePreferences();
- ExitToShell(); /* Quit the application. */
- }
-
-
-
-